package openase.audiosearch.comm.response.decoder;

import java.nio.ByteBuffer;

import openase.audiosearch.comm.StringFormatUtils;
import openase.audiosearch.comm.response.ExecutionError;


public class ExecutionErrorResponseDecoder implements ResponseDecoder<ExecutionError> {

	public ExecutionError decode(ByteBuffer inputBuffer) {
		int sz = inputBuffer.getInt();
		byte[] bytes = new byte[sz];
		inputBuffer.get(bytes);

		String errorMessage = StringFormatUtils.getUtf8(bytes);

		return new ExecutionError(errorMessage);
	}

}
